package com.example.springbooteasycode.zjrc.project.Koal;

public class ByteArrayHexExample {
    public static String bytesToHex(byte[] bytes) {
        StringBuilder result = new StringBuilder();
        for (byte b : bytes) {
            result.append(String.format("%02X", b));
        }
        return result.toString();
    }

    public static void main(String[] args) {
        byte[] arr = {1, 2, 3};
        String hexStr = bytesToHex(arr);
        System.out.println(hexStr); // 输出：010203
    }
}
